<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>欢迎使用</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
	.layui-col-sm6,.layui-col-sm12{padding-top:0;padding-left:0}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">

       <!-- <div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">客户总数</div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('member/index')}'">{:number_format($memberCount)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($memberLastDayCount)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">{:number_format($memberThisMonthCount)}</span></p>
          </div>
        </div>
      </div>
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">收款金额</div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="color:#558800"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($wxpayCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($wxpayLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($wxpayThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">已提现金额</div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($withdrawCount,2)}</p>
            <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($withdrawLastDayCount,2)}</span></p>
            <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($withdrawThisMonthCount,2)}</span></p>
          </div>
        </div>
      </div>-->
			<div class="layui-col-sm6 layui-col-md3">
        <div class="layui-card">
          <div class="layui-card-header">菜品数量</div>
          <div class="layui-card-body layuiadmin-card-list">
            <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantProduct/index')}'">{:number_format($data['productCount'])}</p>
            <p>未上架 <span class="layuiadmin-span-color">{:number_format($data['productCount0'])}</span></p>
            <p>已上架 <span class="layuiadmin-span-color">{:number_format($data['productCount1'])}</span></p>
          </div>
        </div>
      </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
              <div class="layui-card-header">堂食订单</div>
              <div class="layui-card-body layuiadmin-card-list">
                <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantShopOrder/index')}'">{:number_format($data['shopOrderCount'])}</p>
                <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($data['shopOrderLastDayCount'])}</span></p>
                <p>本月新增 <span class="layuiadmin-span-color">{:number_format($data['shopOrderThisMonthCount'])}</span></p>
              </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
              <div class="layui-card-header">堂食订单金额</div>
              <div class="layui-card-body layuiadmin-card-list">
                <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantShopOrder/index')}'">{:number_format($data['shopOrderMoney'],2)}</p>
                <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($data['shopOrderMoneyLastDayCount'])}</span></p>
                <p>本月新增 <span class="layuiadmin-span-color">{:number_format($data['shopOrderMoneyThisMonthCount'])}</span></p>
              </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header">堂食订单退款金额</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font" style="color:#885500"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($data['refundMoney'],2)}</p>
                    <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($data['refundMoneyLastDay'],2)}</span></p>
                    <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($data['refundMoneyThisMonth'],2)}</span></p>
                </div>
            </div>
        </div>

        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header">餐桌</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantTable/index')}'">{:number_format($data['tableCount'])}</p>
                    <p>空闲 <span class="layuiadmin-span-color">{:number_format($data['tableCount0'])}</span></p>
                    <p>入座 <span class="layuiadmin-span-color">{:number_format($data['tableCount2'])}</span></p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header">外卖订单</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantTakeawayOrder/index')}'">{:number_format($data['takeawayOrderCount'])}</p>
                    <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($data['takeawayOrderLastDayCount'])}</span></p>
                    <p>本月新增 <span class="layuiadmin-span-color">{:number_format($data['takeawayOrderThisMonthCount'])}</span></p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header">外卖订单金额</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font" style="cursor:pointer" onclick="location.href='{:url('RestaurantTakeawayOrder/index')}'">{:number_format($data['takeawayOrderMoney'],2)}</p>
                    <p>昨日新增 <span class="layuiadmin-span-color">{:number_format($data['takeawayOrderMoneyLastDayCount'])}</span></p>
                    <p>本月新增 <span class="layuiadmin-span-color">{:number_format($data['takeawayOrderMoneyThisMonthCount'])}</span></p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm6 layui-col-md3">
            <div class="layui-card">
              <div class="layui-card-header">外卖订单退款金额</div>
              <div class="layui-card-body layuiadmin-card-list">
                <p class="layuiadmin-big-font" style="color:#885500"><span style="font-size:16px;height:20px;line-height:20px">￥</span>{:number_format($data['takeawayRefundMoney'],2)}</p>
                <p>昨日新增 <span class="layuiadmin-span-color">￥{:number_format($data['takeawayRefundMoneyLastDay'],2)}</span></p>
                <p>本月新增 <span class="layuiadmin-span-color">￥{:number_format($data['takeawayRefundMoneyThisMonth'],2)}</span></p>
              </div>
            </div>
        </div>

      <div class="layui-col-sm12">
				<div class="layui-card"> 
					<div class="layui-card-header">最近30天数据曲线</div>
					<div class="layui-card-body">
						<div class="layui-row">
							<div class="layui-col-sm9">
								<div class="layui-carousel layadmin-carousel layadmin-dataview" style="width:100%" id="chart1"></div>
							</div>
							<div class="layui-col-sm3">
								<div style="padding-top:70px"></div>
								{if $bid == 0}
								<div style="margin:5px 0;"><span onclick="getchart(1,'客户总数')" style="cursor:pointer">客户总数</span></div>
								<div style="margin:5px 0;"><span onclick="getchart(2,'新增客户数')" style="cursor:pointer">新增客户数</span></div>
								<div style="margin:5px 0;"><span onclick="getchart(3,'收款金额')" style="cursor:pointer">收款金额</div>
								{/if}
								<div style="margin:5px 0;"><span onclick="getchart(4,'订单金额')" style="cursor:pointer">订单金额</div>
								<div style="margin:5px 0;"><span onclick="getchart(5,'订单数')" style="cursor:pointer">订单数</div>
							</div>
						</div>
					</div>
				</div>
      </div>
		</div>
  </div>
	{include file="public/js"/}
	<script src="__STATIC__/admin/js/echarts.min.js"></script>
	<script type="text/javascript">
	var nowtime = "{:time()}";
	$(function(){
		setInterval(function(){
			nowtime++;
			var date = getLocalTime(nowtime);
			$('#systime').html(date);
		},1000)
	})
	function getLocalTime(time) {     
		var date = new Date(time * 1000);  
		var year = date.getFullYear();
		var month = date.getMonth() + 1;
		var day = parseInt(date.getDate());
		var hour = date.getHours();
		var minute = date.getMinutes();
		var second = date.getSeconds();
		return year + '-' + (month <10 ? '0' + month : month) + '-' + (day < 10 ? ('0' + day) : day) + ' '+(hour <10 ? '0' + hour : hour)+':'+(minute <10 ? '0' + minute : minute)+':'+(second <10 ? '0' + second : second);  
	}
	var myChart = echarts.init(document.getElementById("chart1"));
	{if $bid == 0}
	option = {
		title: {
			text: '客户数',textStyle:{fontSize:12},x: "center"
		},
		tooltip: {
			trigger: 'axis'
		},
		xAxis: {
			//name:'日期',
			boundaryGap: false,
			type: 'category',
			data: {:json_encode($dateArr)}
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			name:'客户数',
			data: {:json_encode($dataArr)},
			type: 'line'
		}]
	}
	{else}
	option = {
		title: {
			text: '订单金额',textStyle:{fontSize:12},x: "center"
		},
		tooltip: {
			trigger: 'axis'
		},
		xAxis: {
			//name:'日期',
			boundaryGap: false,
			type: 'category',
			data: {:json_encode($dateArr)}
		},
		yAxis: {
			type: 'value'
		},
		series: [{
			name:'订单金额',
			data: {:json_encode($dataArr)},
			type: 'line'
		}]
	}
	{/if}
	myChart.setOption(option,true);
	//getchart(1,'客户数');
	function getchart(type,title){
		var index = layer.load();
		$.post('',{op:'getdata',type:type},function(res){
			layer.close(index);
			option = {
				title: {
					text: title,textStyle:{fontSize:12},x: "center"
				},
				tooltip: {
					trigger: 'axis'
				},
				xAxis: {
					//name:'日期',
					boundaryGap: false,
					type: 'category',
					data: res.dateArr
				},
				yAxis: {
					type: 'value'
				},
				series: [{
					name:title,
					data: res.dataArr,
					type: 'line'
				}]
			}
			myChart.setOption(option,true);
		})
		
	}
	</script>
	{include file="public/copyright"/}
</body>
</html>